#########################################################
## MOD Title:  Smilies Dropdown Menu
## MOD Author:	Afkamm < phpbb@afkamm.co.uk >
## MOD Description:	Makes a drop down menu which contains a list of all the smilies	installed
##			on your board. When you select a smiley, it appears next to the box.
##		 	The code is then inserted like normal when you click the smiley.
##
## MOD Version: 1.0.1
## 
## Installation Level:  Easy 
## Installation Time:   5 minutes
##
## Files To Edit: 5
##			posting.php
##			privmsg.php
##			includes/functions_post.php
##			language/language_english/main_lang.php
##			templates/subSilver/posting_body.tpl
## Included Files: 0
##			
#########################################################
## Security Disclaimer: I take no responsibility for you putting a red item in with your whites. :P 
#########################################################
## Author Notes:
##
##	This MOD is loosely based on the Drop Down Smilie MOD by radmanics.
##	Some of the javascript code from that MOD was used in this MOD.
##	Other than that, all code is mine. I recommend this mod for boards
##	that have less than 100 smilies installed.
##
##	Any problems or questions then please contact me. -- Marc :)
##
#########################################################
## Credits:
##
##	radmanics < radmanics@dial.pipex.com > (David Race) http://members.lycos.co.uk/coolcodesportal/
##
#########################################################
## MOD History:
##
##	24/09/04 - 1.0.1
##	- Corrected some html changes that I hadn't noticed.
##
##	26/03/04 - 1.0.0
##	- Initial release.
##
############################################################## 
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
#########################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
#########################################################
# 
#-----[ OPEN ]-------------------------------------------
# 
posting.php 
# 
#-----[ FIND ]-------------------------------------------
# 
// Generate smilies listing for page output
generate_smilies('inline', PAGE_POSTING);
# 
#-----[ AFTER, ADD ]-------------------------------------
#
 
// Generate smilies dropdown
generate_smilies_dropdown();
#
#-----[ OPEN ]-------------------------------------------
#
privmsg.php
#
#-----[ FIND ]-------------------------------------------
#
generate_smilies('inline', PAGE_PRIVMSGS);
#
#-----[ AFTER, ADD ]-------------------------------------
#

	// Generate smilies dropdown
	generate_smilies_dropdown();
#
#-----[ OPEN ]-------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]-------------------------------------------
# 
/**
* Called from within prepare_message
#
#-----[ BEFORE, ADD ]-------------------------------------
#
//
// Create a drop down list with installed smilies.
//
function generate_smilies_dropdown()
{
global $db, $board_config, $template, $lang, $phpbb_root_path;

	// Get all the smilies.
	$sql = "SELECT code, smile_url FROM " . SMILIES_TABLE . " ORDER BY code ASC";
	$result = $db->sql_query($sql);
	if( !$result ) { message_die(GENERAL_ERROR, "Couldn't obtain smilies from database", "", __LINE__, __FILE__, $sql); }
	$smile_row = $db->sql_fetchrowset($result);
	$count = $db->sql_numrows($result);

	// Setup the drop down menu of smiley filenames for the add part of the page.
	$filename_list = '';
	for ($i=1; $i<=$count; $i++) {
		$filename_list .= '<option value="' . $smile_row[$i]['smile_url'] . '" id=" ' . $smile_row[$i]['code'] . ' ">' . $smile_row[$i]['code'] . '</option>';
	}

	$template->set_filenames(array(
		"body" => "posting_body.tpl")
	);

	$template->assign_vars(array(
		"L_SMILIES" => $lang['dropdown_title'],
		"L_SMILEY_MENU1" => $lang['dropdown_smilies1'],
		"L_SMILEY_MENU2" => $lang['dropdown_smilies2'],
		"SMILEY_IMG" => $board_config['smilies_path'] . '/' . $smile_row[1]['smile_url'],
		"SMILEY_CODE" => $smile_row[1]['code'],
		"S_SMILEY_BASEDIR" => $board_config['smilies_path'],
		"S_DROP_DOWN" => $filename_list)
	);

} // End generate_smilies_dropdown

#
#-----[ OPEN ]-------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]-------------------------------------------
#
$lang['bbcode_f_help'] =
#
#-----[ AFTER, ADD ]-------------------------------------
#

// Start Smilies Dropdown menu Mod
$lang['dropdown_title'] = 'Smilies';
$lang['dropdown_smilies1'] = 'Select a smiley.';
$lang['dropdown_smilies2'] = 'Click smiley to enter code.';
// End Smilies Dropdown menu Mod
#
#-----[ OPEN ]-------------------------------------------
#
templates/subSilver/posting_body.tpl
# 
#-----[ FIND ]-------------------------------------------
# 
f_help = "{L_BBCODE_F_HELP}";
# 
#-----[ AFTER, ADD ]-------------------------------------
# 

// Start smilies drop down menu mod
smile1_help = "{L_SMILEY_MENU1}";
smile2_help = "{L_SMILEY_MENU2}";

// This function was taken from phpBB smiley admin panel
function update_smiley(newimage) {
	document.smiley_image.src = "{S_SMILEY_BASEDIR}/" + newimage;
}

// This function taken and modified from the UBB version.
function emoticon_drop(text) {
	emoticon_code = "" + text;
	current_msg = document.post.message.value;

	document.post.message.value = current_msg+emoticon_code;
	document.post.message.focus();
	return;
}
// End smilies drop down menu mod
#
#-----[ FIND ]-------------------------------------------
#
<!-- END switch_smilies_extra -->
# 
#-----[ AFTER, ADD ]-------------------------------------
# 
				<!-- Start Smilies Dropdown menu Mod -->
				<tr>
				  <td colspan="2">&nbsp;</td>
				</tr>
				<tr>
				  <td colspan="2"><span class="genmed">&nbsp;{L_SMILIES}:
					<select name="smile_url" onchange="update_smiley(this.options[selectedIndex].value);" onmouseover="helpline('smile1')">
					  {S_DROP_DOWN}
					</select>
					<img name="smiley_image" src="{SMILEY_IMG}" border="0" alt="" onmouseover="helpline('smile2'); this.style.cursor='hand';" onclick="emoticon_drop(document.post.smile_url.options[document.post.smile_url.selectedIndex].id)" />
				  </span></td>
				</tr>
				<!-- End Smilies Dropdown menu Mod -->
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM